package br.com.scaled.activity;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import br.com.scaled.list.TonList;

public class ListaTonsActivity extends ListActivity {
	
	public static final String TAG = "listaTonsActivity";
	
	public void onCreate(Bundle savedInstance) {
		Log.i(TAG, "onCreate");
		super.onCreate(savedInstance);
		
		setListAdapter(new ArrayAdapter<String>(this,  android.R.layout.simple_list_item_1, TonList.getTonList()));
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Log.i(TAG, "onListItemClick");
		super.onListItemClick(l, v, position, id);
		
		Object o = this.getListAdapter().getItem(position);
		Intent intent = new Intent(this, ListaEscalaActivity.class);
		intent.putExtra("ton", o.toString());
		startActivity(intent);
	}
}
